package com.kevin.demo;

import java.util.concurrent.atomic.AtomicInteger;

import org.apache.log4j.Logger;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.quartz.SchedulerException;

public class JobDemo implements Job {
	private static Logger logger = Logger.getLogger(JobDemo.class);
	private static AtomicInteger count  =new AtomicInteger(0);
	@Override
	public void execute(JobExecutionContext arg0) throws JobExecutionException {
		logger.info(Thread.currentThread().getName() + "----------------begin------------------"+count.incrementAndGet());
		try {
//			arg0.get
			Thread.sleep(6000);
		} catch (InterruptedException e) {
			logger.error(e.getMessage(), e);
		}
//		logger.info("-----------------end-----------------");
	}

	public static void main(String[] args) {
		try {
			QuartzDemo.scheduler.start();
		} catch (SchedulerException e) {
			logger.error(e.getMessage(), e);
		}
	}

}